package com.example.dbsample.web;

import com.example.dbsample.annotation.RecordChange;
import com.example.dbsample.mapper.SysParamsMapper;
import com.example.dbsample.model.bo.MockPostObject;
import com.example.dbsample.model.bo.OperateType;
import com.example.dbsample.model.bo.RespCallSession;
import com.example.dbsample.model.http.LujsResponse;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

@RestController
@RequestMapping("/controllerFactoryController")
public class ControllerFactoryController extends BaseRest {
    //@Autowired
    //ControllerFactory controllerFactory;
    //
    //@PostMapping("/v1")
    //public LujsResponse<RespCallSession> mockTTS() {
    //
    //    BaseRest mockController = controllerFactory.getMockController("mock");
    //
    //    System.out.printf("成功请求接口/ControllerFactoryController");
    //
    //    return LujsResponse.ofSuccess(null);
    //}
    //
    //@PostMapping("/v2")
    //public LujsResponse<RespCallSession> v2(@RequestBody Map<String, Object> message) {
    //
    //    BaseRest mockController = controllerFactory.getMockController("mock");
    //
    //    System.out.println("成功请求接口/ControllerFactoryController");
    //
    //    return LujsResponse.ofSuccess(null);
    //}

    @PostMapping("/v3")
    @RecordChange(operate = OperateType.UPDATE, mapper = SysParamsMapper.class, idKey = "appId", idType = "String", operateDesc = "修改黑名单", module = "黑名单管理")
    //public LujsResponse<RespCallSession> mockTtsV3(@RequestBody String message) {
    public LujsResponse<RespCallSession> mockTtsV3(@RequestBody MockPostObject mockPostObject) {
        //BaseRest mockController = controllerFactory.getMockController("mock");

        System.out.printf("成功请求接口/ControllerFactoryController");

        return LujsResponse.ofSuccess(null);
    }
}